import request from "@/utils/request";
const prePath = "/patrol";
//巡检计划分页
export function getPlanPage(data) {
  return request({
    url: prePath + '/plan/customizeList/page',
    method: "post",
    data
  })
}

//新增巡检计划
export function creatPlan(data) {
  return request({
    url: prePath + '/plan',
    method: "post",
    data
  })
}

//修改巡检计划
export function updatePlan(data) {
  return request({
    url: prePath + '/plan',
    method: "put",
    data
  })
}

//获取一条巡检计划
export function getPlanById(id) {
  return request({
    url: prePath + '/plan/'+id,
    method: "get"
  })
}
//停用巡检计划
export function planDisabled(data) {
  return request({
    url: prePath + '/plan/disabled',
    method: "post",
    data
  })
}
//启用巡检计划
export function planEnabled(data) {
  return request({
    url: prePath + '/plan/enabled',
    method: "post",
    data
  })
}

//修改巡检任务
export function updateTask(data) {
  return request({
    url: prePath + '/task',
    method: "put",
    data
  })
}

//修改巡检任务
export function creatTask(data) {
  return request({
    url: prePath + '/task',
    method: "post",
    data
  })
}

//删除巡检任务
export function deleteTask(id) {
  return request({
    url: prePath + '/task/'+id,
    method: "delete",
  })
}

//巡检任务分页
export function getTaskPage(data) {
  return request({
    url: prePath + '/task/customizeList/page',
    method: "post",
    data
  })
}

//巡检任务全部
export function getTaskAll(data) {
  return request({
    url: prePath + '/task/customizeList/all',
    method: "post",
    data
  })
}

//获取一条巡检任务
export function getTaskById(id) {
  return request({
    url: prePath + '/task/'+id,
    method: "get"
  })
}

//获巡检任务巡检点
export function getPlanTaskAreaAll(data) {
  return request({
    url: prePath + '/planTaskArea/customizeList/all',
    method: "post",
    data
  })
}
//获巡检任务巡检点详情
export function getPlanTaskItemAll(params) {
  return request({
    url: prePath + '/planTaskItem/all',
    method: "get",
    params
  })
}
//巡检任务巡检点详情更新多条
export function planTaskItemUpdateBatchList(data) {
  return request({
    url: prePath + '/planTaskItem/updateBatchList',
    method: "put",
    data
  })
}
//巡检任务开始
export function taskStart(data) {
  return request({
    url: prePath + '/task/start',
    method: "post",
    data
  })
}
//巡检任务完成
export function taskCompleted(data) {
  return request({
    url: prePath + '/task/completed',
    method: "post",
    data
  })
}
//巡检任务取消
export function taskCancel(data) {
  return request({
    url: prePath + '/task/cancel',
    method: "post",
    data
  })
}

//分页获巡检任务明细
export function getPlanTaskAreaCustomizeListPage(data) {
  return request({
    url: prePath + '/planTaskArea/customizeList/page',
    method: 'post',
    data
  })
}
//巡检任务明细分组
export function getPlanTaskAreaCustomizeListGroup(data) {
  return request({
    url: prePath + '/planTaskArea/customizeGroups',
    method: 'post',
    data
  })
}
//巡检计划导出
export function excelPlanOrderList(data) {
  return request({
    url: prePath + `/plan/excelOrderList`,
    method: "post",
    data,
    responseType: "blob"
  });
}
//巡检计划打印
export function printPlanOrderList(data) {
  return request({
    url: prePath + '/plan/printOrderList',
    method: 'post',
    data
  })
}
//巡检任务导出详情
export function excelTaskOrder(data) {
  return request({
    url: prePath + `/task/excelOrder`,
    method: "post",
    data,
    responseType: "blob"
  });
}
//巡检计划打印详情
export function printTaskOrder(data) {
  return request({
    url: prePath + '/task/printOrder',
    method: 'post',
    data
  })
}
//巡检任务导出详情
export function excelTaskOrderList(data) {
  return request({
    url: prePath + `/task/excelOrderList`,
    method: "post",
    data,
    responseType: "blob"
  });
}
//巡检计划单打印
export function printTaskOrderList(data) {
  return request({
    url: prePath + '/task/printOrderList',
    method: 'post',
    data
  })
}
//巡检任务导出明细页
export function excelPlanTaskAreaDetailList(data) {
  return request({
    url: prePath + `/planTaskArea/excelDetailList`,
    method: "post",
    data,
    responseType: "blob"
  });
}
//巡检计划打印明细页
export function printPlanTaskAreaDetailList(data) {
  return request({
    url: prePath + '/planTaskArea/printDetailList',
    method: 'post',
    data
  })
}

//巡检记录登记-新增
export function getPatrolRecoredCustomizeListPage(data) {
  return request({
    url: prePath + '/recored/customizeList/page',
    method: 'post',
    data,
  })
}
export function getPatrolRecoredCustomizeListAll(data) {
  return request({
    url: prePath + '/recoredDetail/customizeList/page',
    method: 'post',
    data,
  })
}
export function createPatrolRecored(data) {
  return request({
    url: prePath + '/recored',
    method: 'post',
    data,
  })
}
//巡检记录登记-修改
export function updatePatrolRecored(data) {
  return request({
    url: prePath + '/recored',
    method: 'put',
    data,
  })
}
//巡检记录登记-根据{id}获取一条数据
export function getPatrolRecoredById(id) {
  return request({
    url: prePath + '/recored/' + id,
    method: 'get',
  })
}

export function deleteRecored(data) {
  return request({
    url: prePath + '/recored',
    method: 'delete',
    data,
  })
}
// 巡检记录登记 列表打印
export function printRecoredOrderList(data) {
  return request({
    url: prePath + '/recored/printOrderList',
    method: 'post',
    data
  })
}
// 巡检记录登记 列表导出
export function excelRecoredOrderList(data) {
  return request({
    url: prePath + `/recored/excel/list`,
    method: "post",
    data,
    responseType: "blob"
  });
}
// 明细
export function excelrecoredDetailOrderList(data) {
  return request({
    url: prePath + `/recoredDetail/excel/list`,
    method: "post",
    data,
    responseType: "blob"
  });
}
// 详情
export function excelrecoredStatementOrderList(data) {
  return request({
    url: prePath + `/recored/excel/statement`,
    method: "post",
    data,
    responseType: "blob"
  });
}
// 根据资产卡片id查询巡检明细列表
export function getrecoredByAsset(id) {
  return request({
    url: prePath + '/recoredDetail/byAsset?assetId=' + id,
    method: 'get',
  })
}